package com.nb.cloud.doc.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 出版社
 * @author lihaoyang6
 * @date 2024年07月18日 14:32
 */
@Getter
@AllArgsConstructor
public enum PressEnum {
A(1,	"人教版"),
B(2,	"北师大版"),
C(3	,"苏教版"),
D(4,"沪教版"),
E(5,"青岛版（六三制）"),
F(6,"青岛版（五四制）"),
G(7,"西师大版"),
H(8,"浙教版"),
I(9,"冀教版"),
J(10,"北京版"),
K(11,"人教版一起点"),
L(12,"外研版一起点"),
M(13,"冀教版一起点"),
N(14,"译林版一起点"),
O(15,"北京版一起点"),
P(16,"牛津上海版试用本一起点（拓展版）"),
Q(17,"部编版（人教版）"),

    ;

    private final Integer code;

    private final String text;

    public static Integer getCodeByName(String text){
        if(StringUtils.isBlank(text)){
            return -1;
        }
        for(PressEnum pe : PressEnum.values()){
            if(StringUtils.contains(pe.getText(),text)){
                return pe.getCode();
            }
        }
        return -1;
    }
}
